#!/bin/bash
echo "makefile..."
make
make clean

# Config Setting
ROUND=3
COUNT=1
ROW=3 # integer limited
COL=4 # interger limited
INT="./source/int_matrices"
DOUBLE="./source/double_matrices"

if [[ $ROUND -lt 0 || $ROW -lt 1 || $COL -lt 1 || "$INT" == "" || "$DOUBLE" == "" ]];
then
echo "Input Error!"
exit 0
fi

# test
echo "" > result 2>error
echo "" > error
echo "test and redirect the result to a text file..."
while (( $COUNT<=$ROUND ))
do
	echo "Epoch $COUNT..."
	./generator $ROW $COL $INT $DOUBLE
	echo "Epoch $COUNT: " >> result 2>> error 
	./test $INT $DOUBLE >> result 2>>error
	let "COUNT++"
	sleep 1
done


exit 0
